package com.x.erp.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.CarSelectTemplateDao;
import com.x.erp.manage.CarSelectTemplateManage;
import com.x.erp.model.CarSelectTemplate;
import com.x.erp.rpc.CarSelectTemplateRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;

/**
 * 车辆查询模板订阅服务
 * 
 * @author pansong
 *
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.CarSelectTemplateRpcService", timeout = 60000)
public class CarSelectTemplateService extends BaseService implements CarSelectTemplateRpcService {

	@Autowired
	private CarSelectTemplateDao carSelectTemplateDao;

	@Autowired
	private CarSelectTemplateManage carSelectTemplateManage;

	/**
	 * 新增车辆查询模板订阅信息
	 * 
	 * @param carSelectTemplate
	 * @return
	 */
	@Override
	public void insertCarSelectTemplate(CarSelectTemplate carSelectTemplate, List<CarSelectTemplate> list) {
		try {
			carSelectTemplateManage.insertCarSelectTemplate(carSelectTemplate, list);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}
	/**
	 * 通过分组查询车辆查询模板订阅列表
	 * 
	 * @param carSelectTemplate
	 * @return
	 */
	@Override
	public List<CarSelectTemplate> selectCarSelectTemplateListByGroup(CarSelectTemplate carSelectTemplate) {
		try {
			return carSelectTemplateDao.selectCarSelectTemplateListByGroup(carSelectTemplate);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 查询车辆查询模板订阅列表
	 * 
	 * @param carSelectTemplate
	 * @return
	 */
	@Override
	public List<CarSelectTemplate> selectCarSelectTemplateList(CarSelectTemplate carSelectTemplate) {
		try {
			return carSelectTemplateDao.selectCarSelectTemplateList(carSelectTemplate);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 删除车辆查询模板订阅信息
	 * 
	 * @param carSelectTemplate
	 * @return
	 */
	@Override
	public int deleteCarSelectTemplate(CarSelectTemplate carSelectTemplate) {
		try {
			return this.delete(carSelectTemplate);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
